import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import '@/permission'
// 引入ElementUI
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import 'babel-polyfill'

import './common/index.css'

import Distpicker from 'v-distpicker'

Vue.component('v-distpicker', Distpicker)

Vue.config.productionTip = false

Vue.use(ElementUI)

import util from './api/util'

Vue.use(util)

// Vue自定义指令，防止鼠标双击重复提交
Vue.directive('noMoreClick', {
  inserted (el, binding) {
    el.addEventListener('click', e => {
      el.classList.add('is-disabled')
      el.disabled = true
      setTimeout(() => {
        el.disabled = false
        el.classList.remove('is-disabled')
      }, 3000)
    })
  }
})

/* eslint-disable no-new */
new Vue({
  router,
  store,
  template: '<App/>',
  components: {App}
}).$mount('#app')
